<extend name="Common:base" />
<block name="head"></block>
<block name="body">
	<div id="app" class="container">
		<div class="wrapp" v-show="show" style="display:none">
			<el-row>
			  <el-col :span="12">
			    <el-form :inline="true" ref="searchForm" :model="searchForm">
			      <el-form-item prop="name">
			       <el-input placeholder="请输入标题关键字" v-model="searchForm.name"></el-input>
			      </el-form-item>
			      <el-form-item>
			       <el-button type="primary" icon="search" @click="dataReload">查询</el-button>
			       <el-tooltip content="清空搜索框并刷新表格数据" placement="right">
			        <el-button @click="searchReset" style="margin-left:10px;">重置</el-button>
			       </el-tooltip>
			      </el-form-item>
			    </el-form>
			  </el-col>

		  </el-row>
		  <el-row>
		    <el-col :span="24">
		      <el-table :data="dataList" border  v-loading="dataLoad" element-loading-text="{:L('DATA_LOGIN')}" ref="select" @selection-change="handleSelectionChange">
		        <el-table-column type="selection" align="center" width="50"></el-table-column>
		        <el-table-column label="序号" align="center" :formatter="handleIndex" width="65"></el-table-column>
		        <el-table-column label="标题" prop="title" align="center" ></el-table-column>
		        <el-table-column label="内容" prop="content" align="center" ></el-table-column>
		        <el-table-column label="发送时间" prop="time" align="center" ></el-table-column> 
		        <el-table-column label="操作人员" prop="from_id" align="center" >
				</el-table-column>
		      </el-table>
		    </el-col>
		  </el-row>

		  <el-row type="flex"  justify="space-between" align="middle"  class="row-bg">
            <el-col :span="12">
              <div class="grid-content bg-purple">
              	 <el-tooltip content="多选批量删除" placement="right">
              	   <el-button size="small" type="warning" icon="delete" @click="handleDeletes">批量删除
              	   </el-button>
              	 </el-tooltip>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple-light pull-right">
		        <!-- page -->
		        <include file="Common:_pagination" />
		        <!-- / page -->
              </div>
            </el-col>
		  </el-row>
		</div>
	</div>
</block>
<block name="scripts">
<script>
  window.defaultOption.setDatas({
	  loadDataList:[],
  }).setForm('search',{
  	name:'',
  }).setMethod("handleDeletes", function(url){
	  if(this.multipleSelection.length <= 0){
		  this.$message.error('请先选择消息');
		  return false;
	  }else{
		  if (!arguments[2]) {
			  url= this.page.deleteUrl;
		  }
		  var selectedIds = new Array();
		  for(var i=0; i<this.multipleSelection.length; i++){
			  selectedIds[i] = this.multipleSelection[i].id;
		  }
		  var vmThis = this;
		  this.$confirm('确定删除?', '提示', {
			  confirmButtonText: '确定',
			  cancelButtonText: '取消',
			  type: 'warning'
		  }).then(function(){
			  vmThis.$http.post(url, {ids:selectedIds}).then(function(response){
				  vmThis.$message({
					  type: 'success',
					  message: '删除成功!'
				  });
				  vmThis.loadDatalist();
			  }, function(response){
				  vmThis.$message({
					  type: 'error',
					  message: '删除失败'
				  });
			  })
		  }).catch(function() {
			  vmThis.$message({
				  type: 'info',
				  message: '已取消删除'
			  });
		  });
	  }

  }).setMethod('handleSelectionChange',function(val){
	  this.multipleSelection = val;
  });
</script>
</block>